

log := thirdparty/log/log.h thirdparty/log/log.c
CFLAGS := -g -O0-Wall
log_test: test/log_test.c $(log)
	-gcc $(CFLAGS) $^ -o $@ -I thirdparty
#./$@
#-rm $@

json:=thirdparty/cJSON/cJSON.h thirdparty/cJSON/cJSON.c

json_test: test/cjson_test.c $(json) $(log)
	-gcc $^ -o $@ -I thirdparty
	-./$@
	-rm $@

app_common := app/app_common.h app/app_common.c
app_common_test: test/app_common_test.c $(app_common) $(log)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@

app_message := app/app_message.h app/app_message.c
app_message_test: test/app_message_test.c $(app_message) $(app_common) $(log) $(json)
	-gcc $^ -o $@ -I thirdparty -I app
	-./$@
	-rm $@

mqtt_test: test/mqtt_test.c
	-$(CC) $^ -o $@ -lpaho-mqtt3c
	-./$@
	-rm $@

app_mqtt := app/app_mqtt.h app/app_mqtt.c
app_mqtt_test: test/app_mqtt_test.c $(app_mqtt) $(log)
	-gcc $^ -o $@ -I thirdparty -I app -lpaho-mqtt3c
	-./$@
	-rm $@

app_pool:= app/app_pool.h app/app_pool.c
app_pool_test: test/app_pool_test.c $(app_pool) $(log)
	-gcc $^ -o $@ -I thirdparty -I app 
	-./$@
	-rm $@

app_buffer:= app/app_buffer.h app/app_buffer.c
app_buffer_test: test/app_buffer_test.c $(app_buffer) $(log)
	-gcc $^ -o $@ -I thirdparty -I app 
	-./$@
	-rm $@